<template>
	<view class="box">
		<view class="navBox">
			<fui-tabs :tabs="tabs" @change="tabChange" :current="tabIndex" :sliderBackground="'#FFDD00'"
				:selectedColor="'#000'" :size="24" :short="false" background="none" />
		</view>
		<view class="listBox">
			<swiper :current="tabIndex" :duration="300" @change="tabChange" class="swiper">
				<swiper-item class="fui-swiper__item" v-for="(res,inx) in tabs" :key="inx">
					<scroll-view scroll-y :show-scrollbar="false" class="swiper">
						<view class="" style="padding-bottom: 30rpx;">
							<view class="activeBoxs" v-for="i in 10" :key="i" @click="goDynamicDetails">
								<view class="contentBox">
									上午的时间就白白浪费了，一分钟也没挣到，中午的饭怎么办呀
								</view>
								<!-- 图片 -->
								<view class="activePhotos">
									<view class="activePhoto" v-for="i in 5" :key="i">
										<image src="/static/test/userheader.jpg" mode="aspectFit"></image>
									</view>
								</view>
								<!-- 、视频 -->
								<!-- 			<view class="activePhotos">
									<view class="videoBox" @click.stop>
										<video :id="item.id" style="width: 100%;" object-fit="cover"
											src="https://ffa.firstui.cn/uploadfile/241008103906455.mp4"></video>
									</view>
								</view> -->
								<!-- 状态 -->
								<view class="stateBox">
									<view style="font-size:22rpx;color:#B0B0B0">
										发布时间2024.10.11
									</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabIndex: 0,
				tabs: [
					'待审核',
					'展示中'
				],
			};
		},
		destroyed() {
			console.log('beforeDestroy');
			// this.list.map(v => {
			// 	let video = uni.createVideoContext(v.id, this);
			// 	video.seek(1);
			// 	video.pause();
			// })
		},
		methods: {
			tabChange(e) {
				if (e.name) {
					this.switchTab(e.index);
				} else {
					if (e.detail.source == 'touch') {
						let index = e.target.current || e.detail.current;
						this.switchTab(index);
					}
				}

			},
			switchTab(index) {
				if (this.tabIndex === index) return;
				this.tabIndex = index;
			},
			toDetails() {
				uni.navigateTo({
					url: '/myPages/userDetails'
				})
			},

			goDynamicDetails() {
				if (this.tabIndex != 0) {
					uni.navigateTo({
						url: '/indexPages/BroadcastPage'
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	view {
		box-sizing: border-box;
	}

	.listBox {
		height: calc(100vh - 100rpx);
	}


	.navBox {
		height: 100rpx;
		background-color: white;
	}

	.box {
		height: 100vh;
	}

	.swiper {
		height: 100%;
	}

	.btnBox {
		margin-right: 80rpx;
	}

	.videoBox {
		width: 100%;
		height: 100%;
	}

	.activeBoxs {
		padding: 20rpx;
		background-color: white;
		border-top: 10rpx solid #F9F9F9;
	}

	.avatar {
		width: 90rpx;
		height: 90rpx;
		border-radius: 100%;

		image {
			width: 90rpx;
			height: 90rpx;
			border-radius: 100%;
		}
	}

	.contentBox {
		padding: 30rpx 0rpx;
		font-size: 26rpx;
	}


	.activePhotos {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		padding: 20rpx 0rpx;
		padding-top: 5rpx;
	}

	.activePhoto {
		width: 220rpx;
		height: 220rpx;
		background-color: #CCC;
		border-radius: 10rpx;
		margin-right: 10rpx;
		margin-bottom: 10rpx;

		image {
			border-radius: 10rpx;
			width: 100% !important;
			height: 100% !important;
		}
	}


	.activeBox {
		margin-top: 10rpx;
		height: auto;
		display: flex;
		justify-content: space-between;
		align-items: center;
		// border-bottom: 4rpx solid #f6f6f6;
	}
</style>